{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4d3ffb05",
   "metadata": {},
   "source": [
    "# Structured output from documents\n",
    "\n",
    "This example uses the Pydantic AI framework integrating the **Docling MCP** tools via the `streamable-http` transport.\n",
    "\n",
    "The task is finding and extracting the hardware details of a single board computer datasheet.\n",
    "\n",
    "### Tools\n",
    "\n",
    "- `docling/convert_document_into_docling_document` for converting PDF documents\n",
    "- `docling/export_docling_document_to_markdown` for exporting to markdown"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "15b74297",
   "metadata": {},
   "source": [
    "### Pre-Requisites\n",
    "\n",
    "Before starting this notebook, ensure that you have:\n",
    "1. Followed the instructions in the [Llama Stack README](../llama-stack/README.md) to set up the following resources:\n",
    "  - Inference model with [LM Studio](https://lmstudio.ai/)\n",
    "  - Llama Stack server with the starter template [distribution-starter](https://hub.docker.com/r/llamastack/distribution-starter)\n",
    "\n",
    "2. Started the Docling MCP server with the `conversion` and `generation` groups. See the details in the [README](./README.md)\n",
    "\n",
    "You may want to create a virtual environment to run this notebook, for instance, with [uv](https://docs.astral.sh/uv/).\n",
    "\n",
    "```bash\n",
    "uv venv\n",
    "source .venv/bin/activate\n",
    "uv pip install ipykernel rich pydantic \"pydantic-ai-slim[openai,mcp]\"\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5eef6b33",
   "metadata": {},
   "source": [
    "#### Utilities"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "bbf14ede",
   "metadata": {},
   "outputs": [],
   "source": [
    "# this is needed to run asyncio functions in notebooks\n",
    "import nest_asyncio\n",
    "\n",
    "nest_asyncio.apply()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5e77473c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Utilities for printing results\n",
    "\n",
    "from rich.pretty import pprint\n",
    "from rich.console import Console\n",
    "from pydantic_ai.messages import ModelMessage, ModelRequest\n",
    "\n",
    "console = Console()\n",
    "\n",
    "VERBOSE_STEPS = True\n",
    "\n",
    "\n",
    "def print_user(text: str):\n",
    "    console.print(f\"👤 [cyan]{text}[/cyan]\")\n",
    "\n",
    "\n",
    "def print_assistant(text: str):\n",
    "    console.print(f\"🤖 [green]{text}[/green]\")\n",
    "\n",
    "\n",
    "def print_steps(messages: list[ModelMessage]):\n",
    "    if not VERBOSE_STEPS:\n",
    "        return\n",
    "\n",
    "    step_nr = 0\n",
    "    for message in messages:\n",
    "        if isinstance(message, ModelRequest):\n",
    "            step_nr += 1\n",
    "            console.print(f\"[orange]----- 📍 Reasoning step {step_nr} -----[/orange]\")\n",
    "        console.print(message)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "33ff6865",
   "metadata": {},
   "source": [
    "## Pydantic AI agents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4dfa8c26",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pydantic_ai.models.openai import OpenAIResponsesModel\n",
    "from pydantic_ai.providers.openai import OpenAIProvider\n",
    "from pydantic_ai.mcp import MCPServerStreamableHTTP\n",
    "\n",
    "docling_mcp = MCPServerStreamableHTTP(url=\"http://localhost:8000/mcp\")\n",
    "\n",
    "model = OpenAIResponsesModel(\n",
    "    model_name=\"lms/openai/gpt-oss-20b\",  # name of the model configured in Llama Stack\n",
    "    provider=OpenAIProvider(\n",
    "        base_url=\"http://localhost:8321/v1/openai/v1/\"\n",
    "    ),  # Pointing to the local Llama Stack OpenAI-compatible API\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "fb96c3f1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">👤 <span style=\"color: #008080; text-decoration-color: #008080\">Convert the document on </span><span style=\"color: #008080; text-decoration-color: #008080; text-decoration: underline\">https://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf</span><span style=\"color: #008080; text-decoration-color: #008080\"> to </span>\n",
       "<span style=\"color: #008080; text-decoration-color: #008080\">DoclingDocument. And use its markdown representation for extracting the hardware specs of the card.</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "👤 \u001b[36mConvert the document on \u001b[0m\u001b[4;36mhttps://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf\u001b[0m\u001b[36m to \u001b[0m\n",
       "\u001b[36mDoclingDocument. And use its markdown representation for extracting the hardware specs of the card.\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 📍 Reasoning step <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">1</span> -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 📍 Reasoning step \u001b[1;36m1\u001b[0m -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelRequest</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">UserPromptPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'Convert the document on </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">https://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf to DoclingDocument. And use its markdown </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">representation for extracting the hardware specs of the card.'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, \n",
       "<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">115230</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080\">datetime</span>.timezone.utc<span style=\"font-weight: bold\">))])</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelRequest\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mUserPromptPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mcontent\u001b[0m=\u001b[32m'Convert the document on \u001b[0m\n",
       "\u001b[32mhttps://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf to DoclingDocument. And use its markdown \u001b[0m\n",
       "\u001b[32mrepresentation for extracting the hardware specs of the card.'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \n",
       "\u001b[1;36m13\u001b[0m, \u001b[1;36m115230\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[35mdatetime\u001b[0m.timezone.utc\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelResponse</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolCallPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'convert_document_into_docling_document'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">args</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'{\"source\":\"https://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf\"}'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'563988351'</span><span style=\"font-weight: bold\">)]</span>, <span style=\"color: #808000; text-decoration-color: #808000\">usage</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RequestUsage</span><span style=\"font-weight: bold\">()</span>, <span style=\"color: #808000; text-decoration-color: #808000\">model_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'lms/openai/gpt-oss-20b'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">TzInfo</span><span style=\"font-weight: bold\">(</span>UTC<span style=\"font-weight: bold\">))</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">provider_request_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'resp-03999c03-c11e-431d-9b0a-e39017272d58'</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelResponse\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolCallPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'convert_document_into_docling_document'\u001b[0m, \n",
       "\u001b[33margs\u001b[0m=\u001b[32m'\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"source\":\"https://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf\"\u001b[0m\u001b[32m}\u001b[0m\u001b[32m'\u001b[0m, \n",
       "\u001b[33mtool_call_id\u001b[0m=\u001b[32m'563988351'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[33musage\u001b[0m=\u001b[1;35mRequestUsage\u001b[0m\u001b[1m(\u001b[0m\u001b[1m)\u001b[0m, \u001b[33mmodel_name\u001b[0m=\u001b[32m'lms/openai/gpt-oss-20b'\u001b[0m, \n",
       "\u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[1;35mTzInfo\u001b[0m\u001b[1m(\u001b[0mUTC\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m, \n",
       "\u001b[33mprovider_request_id\u001b[0m=\u001b[32m'resp-03999c03-c11e-431d-9b0a-e39017272d58'\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 📍 Reasoning step <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2</span> -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 📍 Reasoning step \u001b[1;36m2\u001b[0m -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelRequest</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolReturnPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'convert_document_into_docling_document'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'success'</span>: <span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>, \n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">'document_key'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">'111fe71d63919948a89ca8ca7ab3bac1'</span><span style=\"font-weight: bold\">}</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'563988351'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>,\n",
       "<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">15</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">153710</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080\">datetime</span>.timezone.utc<span style=\"font-weight: bold\">))])</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelRequest\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolReturnPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'convert_document_into_docling_document'\u001b[0m, \u001b[33mcontent\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'success'\u001b[0m: \u001b[3;92mTrue\u001b[0m, \n",
       "\u001b[32m'document_key'\u001b[0m: \u001b[32m'111fe71d63919948a89ca8ca7ab3bac1'\u001b[0m\u001b[1m}\u001b[0m, \u001b[33mtool_call_id\u001b[0m=\u001b[32m'563988351'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m,\n",
       "\u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m15\u001b[0m, \u001b[1;36m153710\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[35mdatetime\u001b[0m.timezone.utc\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelResponse</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolCallPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'export_docling_document_to_markdown'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">args</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'{\"document_key\":\"111fe71d63919948a89ca8ca7ab3bac1\"}'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'986651733'</span><span style=\"font-weight: bold\">)]</span>, <span style=\"color: #808000; text-decoration-color: #808000\">usage</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RequestUsage</span><span style=\"font-weight: bold\">()</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">model_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'lms/openai/gpt-oss-20b'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">15</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">TzInfo</span><span style=\"font-weight: bold\">(</span>UTC<span style=\"font-weight: bold\">))</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">provider_request_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'resp-f0d9cba4-e341-4dc2-8366-f7e0bcdbc996'</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelResponse\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolCallPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'export_docling_document_to_markdown'\u001b[0m, \n",
       "\u001b[33margs\u001b[0m=\u001b[32m'\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"document_key\":\"111fe71d63919948a89ca8ca7ab3bac1\"\u001b[0m\u001b[32m}\u001b[0m\u001b[32m'\u001b[0m, \u001b[33mtool_call_id\u001b[0m=\u001b[32m'986651733'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[33musage\u001b[0m=\u001b[1;35mRequestUsage\u001b[0m\u001b[1m(\u001b[0m\u001b[1m)\u001b[0m, \n",
       "\u001b[33mmodel_name\u001b[0m=\u001b[32m'lms/openai/gpt-oss-20b'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m15\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[1;35mTzInfo\u001b[0m\u001b[1m(\u001b[0mUTC\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m, \n",
       "\u001b[33mprovider_request_id\u001b[0m=\u001b[32m'resp-f0d9cba4-e341-4dc2-8366-f7e0bcdbc996'\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 📍 Reasoning step <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">3</span> -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 📍 Reasoning step \u001b[1;36m3\u001b[0m -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelRequest</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolReturnPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'export_docling_document_to_markdown'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"font-weight: bold\">{</span><span style=\"color: #008000; text-decoration-color: #008000\">'document_key'</span>: \n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">'111fe71d63919948a89ca8ca7ab3bac1'</span>, <span style=\"color: #008000; text-decoration-color: #008000\">'markdown'</span>: <span style=\"color: #008000; text-decoration-color: #008000\">\"## XPedite7871\\n\\nThe XPedite7871 is a secure, high-performance </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">single board computer based on the Intel® Xeon® D-2800 series (formerly Eddy Lake) of processors, making it an </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">optimal choice for computationally heavy applications requiring maximum data and information protection.\\n\\nThis 3U</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">VPX-REDI module integrates SecureCOTS™ technology with a Microsemi® PolarFire™ System-on-Chip (SoC) FPGA for </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">hosting custom functions to protect data from being modified or observed and provides an ideal solution when </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">stringent security capabilities are required.\\n\\nThe  XPedite7871  provides  incredible  speed  with  one  </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">100GBASE-KR4,  up  to  two  10GBASE-KR,  and  one 10/100/1000BASE-T Ethernet ports. It accommodates up to 64 GB of </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">DDR4 ECC SDRAM in four channels and up to 32 GB of onboard SLC NAND flash in addition to numerous I/O ports, </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">including USB 2.0, PCIe, and RS-232/422/485 serial through the backplane connectors.\\n\\nThe XPedite7871 offers a </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">SOSA-aligned pinout compatible with backplane slot profile 1F1F2U1TU1T1U1T-14.2.16. The AMPS profile is </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">MODA3-16.2.15-1-F2C-(E8)(P3F)(2E7-E3)(N-N-N-N-M3/M4/M5-N)&amp;lt;N&amp;gt;, although limitations apply. Contact factory for</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">details.\\n\\nWind River VxWorks and X-ES Enterprise Linux (XEL) Board Support Packages (BSPs) are </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">available.\\n\\nXPedite7871\\n\\n## 3U VPX-REDI Modules\\n\\n&lt;!-- image --&gt;\\n\\n## XPedite7871\\n\\nIntel® Xeon® D-2800 </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Processor-Based 3U VPX-REDI Module with 64 GB of DDR4, 100 Gigabit Ethernet, and SecureCOTS™\\n\\n- Supports Intel® </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Xeon® D-2800 series (formerly Eddy Lake) processors\\n- Up to 20 Xeon®-class cores in a single, power-efficient SoC </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">package\\n- SKUs available with native extended temperature support\\n- Designed with SecureCOTS™ technology to </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">support enhanced security and trusted computing\\n- Microsemi® PolarFire™ SoC FPGA with 256 MB SPI flash\\n- 3U VPX </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">(VITA 46) module\\n- Compatible with multiple VITA 65 OpenVPX™ slot profiles\\n- Ruggedized Enhanced Design </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Implementation (REDI) per VITA 48\\n- 64 GB of DDR4 ECC SDRAM in four channels\\n- Up to 256 GB of NAND flash\\n- One </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">100GBASE-KR4 Ethernet port\\n- Up to two 10GBASE-KR Ethernet ports\\n- One 10/100/1000BASE-T Ethernet port\\n- Two x4 </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Gen3, one x4 Gen2, and two x2 Gen2 PCI Express interfaces\\n- Two USB 2.0 ports\\n- Two RS-232/422/485 serial </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">ports\\n- RDMA over Converged Ethernet (RoCE) v2 internet layer protocol support\\n- SOSA-aligned pinout compatible </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">with backplane slot profile 1F1F2U1TU1T1U1T-14.2.16\\n- SOSA-aligned to AMPS profile MODA3-16.2.15-1-F2C-(E8)(P3F) </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">(2E7-E3)(N-N-N-N-M3/M4/M5-N)&amp;lt;N&amp;gt; (I/O limitations apply, contact factory for details)\\n- Wind River VxWorks </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">BSP\\n- X-ES Enterprise Linux (XEL) BSP\\n- Contact factory for availability of Microsoft Windows drivers and other </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">operating systems\\n\\n&lt;!-- image --&gt;\\n\\n&lt;!-- image --&gt;\\n\\n## Extreme Engineering Solutions\\n\\n'Fast, Flexible, </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Customer-Focused Embedded Solutions'\\n\\n9901 Silicon Prairie Parkway · Verona, WI 53593 Phone: 608.833.1155 · Fax: </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">608.827.6171 sales@xes-inc.com · https://www.xes-inc.com\\n\\n## Processor\\n\\n- Intel® Xeon® D-2800 series (formerly </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Eddy Lake) processor\\n- Up to 20 Xeon®-class cores in a single, power-efficient SoC package\\n- SKUs available with </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">native extended temperature support\\n\\n## Memory\\n\\n- 64 GB of DDR4 ECC SDRAM in four channels\\n- Up to 256 GB of </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">NAND flash\\n- 64 MB NOR boot flash\\n- 64 kB EEPROM\\n\\n## Security and Management\\n\\n- Microsemi® PolarFire™ SoC </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">FPGA with 256 MB SPI flash\\n- Designed with SecureCOTS™ technology to support enhanced security and trusted </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">computing\\n- System voltage monitor, power-on/reset control, non-volatile write-protection control\\n- Trusted </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Platform Module (TPM)\\n\\n## VPX (VITA 46) P1 I/O\\n\\n- One 100GBASE-KR4 Ethernet port to P1.A\\n- One x4 PCI Express </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Gen3-capable interface to P1.B\\n- Up to two 10GBASE-KR Ethernet ports to P1.D\\n\\n## VPX (VITA 46) P2 I/O\\n\\n- One </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">10/100/1000BASE-T Ethernet port\\n- One x4 PCI Express Gen3-capable interface\\n- One x4 PCI Express Gen2-capable </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">interface\\n- Two x2 PCI Express Gen2-capable interfaces\\n- Two USB 2.0 ports\\n- Two RS-232/422/485 serial ports\\n- </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Four single-ended FPGA GPIOs\\n\\n## Software Support\\n\\n- RDMA over Converged Ethernet (RoCE) v2 internet layer </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">protocol support\\n- UEFI firmware\\n- Wind River VxWorks BSP\\n- X-ES Enterprise Linux (XEL) BSP\\n- Contact factory </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">for availability of Microsoft Windows drivers and other operating systems\\n\\n## Physical Characteristics\\n\\n- 3U </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">VPX-REDI conduction- or air-cooled form factor\\n\\n•\\n\\nSOSA-aligned pinout compatible with backplane slot profile </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">1F1F2U1TU1T1U1T-14.2.16\\n\\n- SOSA-aligned to AMPS profile MODA3-16.2.15-1-F2C-(E8)(P3F)(2E7-E3) </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">(N-N-N-N-M3/M4/M5-N)&amp;lt;N&amp;gt; (I/O limitations apply, contact factory for details)\\n- Dimensions: 100 mm x 160 </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">mm\\n- 0.8 in. pitch without solder-side cover\\n- 1.0 in. pitch with Two-Level Maintenance (2LM) support\\n\\n## </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Environmental Requirements\\n\\nContact factory for appropriate board configuration based on environmental </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">requirements\\n\\n- Supported ruggedization levels (see chart below): 5\\n- Conformal coating available as an ordering</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">option\\n- Thermal performance will vary based on CPU frequency and application\\n- Contact X-ES for air-cooled </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">development options\\n\\n## Power Requirements\\n\\n- Power will vary based on configuration and usage. Please consult </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">factory.\\n\\n## Ruggedization Level\\n\\n## Level 5\\n\\n| Cooling Method       | Conduction-Cooled                 </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">|\\n|----------------------|-----------------------------------|\\n| OperatingTemperature | -40 to +85°C (board rail </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">surface) |\\n| StorageTemperature   | -55 to +105°C (maximum)           |\\n| Vibration            | 0.1 g²/Hz </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">(maximum), 5 to 2000 Hz |\\n| Shock                | 40 g, 11 ms sawtooth              |\\n| Humidity             | </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">Up to 95% non-condensing          |\\n\\n&lt;!-- image --&gt;\\n\\n&lt;!-- image --&gt;\"</span><span style=\"font-weight: bold\">}</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'986651733'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">16</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">299277</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080\">datetime</span>.timezone.utc<span style=\"font-weight: bold\">))])</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelRequest\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolReturnPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'export_docling_document_to_markdown'\u001b[0m, \u001b[33mcontent\u001b[0m=\u001b[1m{\u001b[0m\u001b[32m'document_key'\u001b[0m: \n",
       "\u001b[32m'111fe71d63919948a89ca8ca7ab3bac1'\u001b[0m, \u001b[32m'markdown'\u001b[0m: \u001b[32m\"## XPedite7871\\n\\nThe XPedite7871 is a secure, high-performance \u001b[0m\n",
       "\u001b[32msingle board computer based on the Intel® Xeon® D-2800 series \u001b[0m\u001b[32m(\u001b[0m\u001b[32mformerly Eddy Lake\u001b[0m\u001b[32m)\u001b[0m\u001b[32m of processors, making it an \u001b[0m\n",
       "\u001b[32moptimal choice for computationally heavy applications requiring maximum data and information protection.\\n\\nThis 3U\u001b[0m\n",
       "\u001b[32mVPX-REDI module integrates SecureCOTS™ technology with a Microsemi® PolarFire™ System-on-Chip \u001b[0m\u001b[32m(\u001b[0m\u001b[32mSoC\u001b[0m\u001b[32m)\u001b[0m\u001b[32m FPGA for \u001b[0m\n",
       "\u001b[32mhosting custom functions to protect data from being modified or observed and provides an ideal solution when \u001b[0m\n",
       "\u001b[32mstringent security capabilities are required.\\n\\nThe  XPedite7871  provides  incredible  speed  with  one  \u001b[0m\n",
       "\u001b[32m100GBASE-KR4,  up  to  two  10GBASE-KR,  and  one 10/100/1000BASE-T Ethernet ports. It accommodates up to 64 GB of \u001b[0m\n",
       "\u001b[32mDDR4 ECC SDRAM in four channels and up to 32 GB of onboard SLC NAND flash in addition to numerous I/O ports, \u001b[0m\n",
       "\u001b[32mincluding USB 2.0, PCIe, and RS-232/422/485 serial through the backplane connectors.\\n\\nThe XPedite7871 offers a \u001b[0m\n",
       "\u001b[32mSOSA-aligned pinout compatible with backplane slot profile 1F1F2U1TU1T1U1T-14.2.16. The AMPS profile is \u001b[0m\n",
       "\u001b[32mMODA3-16.2.15-1-F2C-\u001b[0m\u001b[32m(\u001b[0m\u001b[32mE8\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32mP3F\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2E7-E3\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32mN-N-N-N-M3/M4/M5-N\u001b[0m\u001b[32m)\u001b[0m\u001b[32m&lt;N&gt;, although limitations apply. Contact factory for\u001b[0m\n",
       "\u001b[32mdetails.\\n\\nWind River VxWorks and X-ES Enterprise Linux \u001b[0m\u001b[32m(\u001b[0m\u001b[32mXEL\u001b[0m\u001b[32m)\u001b[0m\u001b[32m Board Support Packages \u001b[0m\u001b[32m(\u001b[0m\u001b[32mBSPs\u001b[0m\u001b[32m)\u001b[0m\u001b[32m are \u001b[0m\n",
       "\u001b[32mavailable.\\n\\nXPedite7871\\n\\n## 3U VPX-REDI Modules\\n\\n\u001b[0m\u001b[32m<\u001b[0m\u001b[32m!-- image -->\\n\\n## XPedite7871\\n\\nIntel® Xeon® D-2800 \u001b[0m\n",
       "\u001b[32mProcessor-Based 3U VPX-REDI Module with 64 GB of DDR4, 100 Gigabit Ethernet, and SecureCOTS™\\n\\n- Supports Intel® \u001b[0m\n",
       "\u001b[32mXeon® D-2800 series \u001b[0m\u001b[32m(\u001b[0m\u001b[32mformerly Eddy Lake\u001b[0m\u001b[32m)\u001b[0m\u001b[32m processors\\n- Up to 20 Xeon®-class cores in a single, power-efficient SoC \u001b[0m\n",
       "\u001b[32mpackage\\n- SKUs available with native extended temperature support\\n- Designed with SecureCOTS™ technology to \u001b[0m\n",
       "\u001b[32msupport enhanced security and trusted computing\\n- Microsemi® PolarFire™ SoC FPGA with 256 MB SPI flash\\n- 3U VPX \u001b[0m\n",
       "\u001b[32m(\u001b[0m\u001b[32mVITA 46\u001b[0m\u001b[32m)\u001b[0m\u001b[32m module\\n- Compatible with multiple VITA 65 OpenVPX™ slot profiles\\n- Ruggedized Enhanced Design \u001b[0m\n",
       "\u001b[32mImplementation \u001b[0m\u001b[32m(\u001b[0m\u001b[32mREDI\u001b[0m\u001b[32m)\u001b[0m\u001b[32m per VITA 48\\n- 64 GB of DDR4 ECC SDRAM in four channels\\n- Up to 256 GB of NAND flash\\n- One \u001b[0m\n",
       "\u001b[32m100GBASE-KR4 Ethernet port\\n- Up to two 10GBASE-KR Ethernet ports\\n- One 10/100/1000BASE-T Ethernet port\\n- Two x4 \u001b[0m\n",
       "\u001b[32mGen3, one x4 Gen2, and two x2 Gen2 PCI Express interfaces\\n- Two USB 2.0 ports\\n- Two RS-232/422/485 serial \u001b[0m\n",
       "\u001b[32mports\\n- RDMA over Converged Ethernet \u001b[0m\u001b[32m(\u001b[0m\u001b[32mRoCE\u001b[0m\u001b[32m)\u001b[0m\u001b[32m v2 internet layer protocol support\\n- SOSA-aligned pinout compatible \u001b[0m\n",
       "\u001b[32mwith backplane slot profile 1F1F2U1TU1T1U1T-14.2.16\\n- SOSA-aligned to AMPS profile MODA3-16.2.15-1-F2C-\u001b[0m\u001b[32m(\u001b[0m\u001b[32mE8\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32mP3F\u001b[0m\u001b[32m)\u001b[0m\u001b[32m \u001b[0m\n",
       "\u001b[32m(\u001b[0m\u001b[32m2E7-E3\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32mN-N-N-N-M3/M4/M5-N\u001b[0m\u001b[32m)\u001b[0m\u001b[32m&lt;N&gt; \u001b[0m\u001b[32m(\u001b[0m\u001b[32mI/O limitations apply, contact factory for details\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\n- Wind River VxWorks \u001b[0m\n",
       "\u001b[32mBSP\\n- X-ES Enterprise Linux \u001b[0m\u001b[32m(\u001b[0m\u001b[32mXEL\u001b[0m\u001b[32m)\u001b[0m\u001b[32m BSP\\n- Contact factory for availability of Microsoft Windows drivers and other \u001b[0m\n",
       "\u001b[32moperating systems\\n\\n<!-- image -->\\n\\n<!-- image -->\\n\\n## Extreme Engineering Solutions\\n\\n'Fast, Flexible, \u001b[0m\n",
       "\u001b[32mCustomer-Focused Embedded Solutions'\\n\\n9901 Silicon Prairie Parkway · Verona, WI 53593 Phone: 608.833.1155 · Fax: \u001b[0m\n",
       "\u001b[32m608.827.6171 sales@xes-inc.com · https://www.xes-inc.com\\n\\n## Processor\\n\\n- Intel® Xeon® D-2800 series \u001b[0m\u001b[32m(\u001b[0m\u001b[32mformerly \u001b[0m\n",
       "\u001b[32mEddy Lake\u001b[0m\u001b[32m)\u001b[0m\u001b[32m processor\\n- Up to 20 Xeon®-class cores in a single, power-efficient SoC package\\n- SKUs available with \u001b[0m\n",
       "\u001b[32mnative extended temperature support\\n\\n## Memory\\n\\n- 64 GB of DDR4 ECC SDRAM in four channels\\n- Up to 256 GB of \u001b[0m\n",
       "\u001b[32mNAND flash\\n- 64 MB NOR boot flash\\n- 64 kB EEPROM\\n\\n## Security and Management\\n\\n- Microsemi® PolarFire™ SoC \u001b[0m\n",
       "\u001b[32mFPGA with 256 MB SPI flash\\n- Designed with SecureCOTS™ technology to support enhanced security and trusted \u001b[0m\n",
       "\u001b[32mcomputing\\n- System voltage monitor, power-on/reset control, non-volatile write-protection control\\n- Trusted \u001b[0m\n",
       "\u001b[32mPlatform Module \u001b[0m\u001b[32m(\u001b[0m\u001b[32mTPM\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\n\\n## VPX \u001b[0m\u001b[32m(\u001b[0m\u001b[32mVITA 46\u001b[0m\u001b[32m)\u001b[0m\u001b[32m P1 I/O\\n\\n- One 100GBASE-KR4 Ethernet port to P1.A\\n- One x4 PCI Express \u001b[0m\n",
       "\u001b[32mGen3-capable interface to P1.B\\n- Up to two 10GBASE-KR Ethernet ports to P1.D\\n\\n## VPX \u001b[0m\u001b[32m(\u001b[0m\u001b[32mVITA 46\u001b[0m\u001b[32m)\u001b[0m\u001b[32m P2 I/O\\n\\n- One \u001b[0m\n",
       "\u001b[32m10/100/1000BASE-T Ethernet port\\n- One x4 PCI Express Gen3-capable interface\\n- One x4 PCI Express Gen2-capable \u001b[0m\n",
       "\u001b[32minterface\\n- Two x2 PCI Express Gen2-capable interfaces\\n- Two USB 2.0 ports\\n- Two RS-232/422/485 serial ports\\n- \u001b[0m\n",
       "\u001b[32mFour single-ended FPGA GPIOs\\n\\n## Software Support\\n\\n- RDMA over Converged Ethernet \u001b[0m\u001b[32m(\u001b[0m\u001b[32mRoCE\u001b[0m\u001b[32m)\u001b[0m\u001b[32m v2 internet layer \u001b[0m\n",
       "\u001b[32mprotocol support\\n- UEFI firmware\\n- Wind River VxWorks BSP\\n- X-ES Enterprise Linux \u001b[0m\u001b[32m(\u001b[0m\u001b[32mXEL\u001b[0m\u001b[32m)\u001b[0m\u001b[32m BSP\\n- Contact factory \u001b[0m\n",
       "\u001b[32mfor availability of Microsoft Windows drivers and other operating systems\\n\\n## Physical Characteristics\\n\\n- 3U \u001b[0m\n",
       "\u001b[32mVPX-REDI conduction- or air-cooled form factor\\n\\n•\\n\\nSOSA-aligned pinout compatible with backplane slot profile \u001b[0m\n",
       "\u001b[32m1F1F2U1TU1T1U1T-14.2.16\\n\\n- SOSA-aligned to AMPS profile MODA3-16.2.15-1-F2C-\u001b[0m\u001b[32m(\u001b[0m\u001b[32mE8\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32mP3F\u001b[0m\u001b[32m)\u001b[0m\u001b[32m(\u001b[0m\u001b[32m2E7-E3\u001b[0m\u001b[32m)\u001b[0m\u001b[32m \u001b[0m\n",
       "\u001b[32m(\u001b[0m\u001b[32mN-N-N-N-M3/M4/M5-N\u001b[0m\u001b[32m)\u001b[0m\u001b[32m&lt;N&gt; \u001b[0m\u001b[32m(\u001b[0m\u001b[32mI/O limitations apply, contact factory for details\u001b[0m\u001b[32m)\u001b[0m\u001b[32m\\n- Dimensions: 100 mm x 160 \u001b[0m\n",
       "\u001b[32mmm\\n- 0.8 in. pitch without solder-side cover\\n- 1.0 in. pitch with Two-Level Maintenance \u001b[0m\u001b[32m(\u001b[0m\u001b[32m2LM\u001b[0m\u001b[32m)\u001b[0m\u001b[32m support\\n\\n## \u001b[0m\n",
       "\u001b[32mEnvironmental Requirements\\n\\nContact factory for appropriate board configuration based on environmental \u001b[0m\n",
       "\u001b[32mrequirements\\n\\n- Supported ruggedization levels \u001b[0m\u001b[32m(\u001b[0m\u001b[32msee chart below\u001b[0m\u001b[32m)\u001b[0m\u001b[32m: 5\\n- Conformal coating available as an ordering\u001b[0m\n",
       "\u001b[32moption\\n- Thermal performance will vary based on CPU frequency and application\\n- Contact X-ES for air-cooled \u001b[0m\n",
       "\u001b[32mdevelopment options\\n\\n## Power Requirements\\n\\n- Power will vary based on configuration and usage. Please consult \u001b[0m\n",
       "\u001b[32mfactory.\\n\\n## Ruggedization Level\\n\\n## Level 5\\n\\n| Cooling Method       | Conduction-Cooled                 \u001b[0m\n",
       "\u001b[32m|\\n|----------------------|-----------------------------------|\\n| OperatingTemperature | -40 to +85°C \u001b[0m\u001b[32m(\u001b[0m\u001b[32mboard rail \u001b[0m\n",
       "\u001b[32msurface\u001b[0m\u001b[32m)\u001b[0m\u001b[32m |\\n| StorageTemperature   | -55 to +105°C \u001b[0m\u001b[32m(\u001b[0m\u001b[32mmaximum\u001b[0m\u001b[32m)\u001b[0m\u001b[32m           |\\n| Vibration            | 0.1 g²/Hz \u001b[0m\n",
       "\u001b[32m(\u001b[0m\u001b[32mmaximum\u001b[0m\u001b[32m)\u001b[0m\u001b[32m, 5 to 2000 Hz |\\n| Shock                | 40 g, 11 ms sawtooth              |\\n| Humidity             | \u001b[0m\n",
       "\u001b[32mUp to 95% non-condensing          |\\n\\n<!-- image -->\\n\\n<!-- image --\u001b[0m\u001b[32m>\u001b[0m\u001b[32m\"\u001b[0m\u001b[1m}\u001b[0m, \u001b[33mtool_call_id\u001b[0m=\u001b[32m'986651733'\u001b[0m, \n",
       "\u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m16\u001b[0m, \u001b[1;36m299277\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[35mdatetime\u001b[0m.timezone.utc\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelResponse</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">TextPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'&lt;|channel|&gt;final_result&lt;|channel|&gt;commentary </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">json&lt;|message|&gt;{\"cpu_name\":\"Intel Xeon D-2800 series\",\"cpu_num_cores\":20,\"memory_type\":\"DDR4 ECC </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">SDRAM\",\"memory_size_gb\":64,\"memory_channels\":4,\"flash_type\":\"NAND Flash\",\"flash_size_gb\":256}'</span><span style=\"font-weight: bold\">)]</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">usage</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RequestUsage</span><span style=\"font-weight: bold\">()</span>, <span style=\"color: #808000; text-decoration-color: #808000\">model_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'lms/openai/gpt-oss-20b'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">16</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">TzInfo</span><span style=\"font-weight: bold\">(</span>UTC<span style=\"font-weight: bold\">))</span>, <span style=\"color: #808000; text-decoration-color: #808000\">provider_request_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'resp-0fcca8b6-fdaa-4bea-9a78-f8a99e6acba7'</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelResponse\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mTextPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mcontent\u001b[0m=\u001b[32m'\u001b[0m\u001b[32m<\u001b[0m\u001b[32m|channel|\u001b[0m\u001b[32m>final_result<|channel|>commentary \u001b[0m\n",
       "\u001b[32mjson<|message|\u001b[0m\u001b[32m>\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"cpu_name\":\"Intel Xeon D-2800 series\",\"cpu_num_cores\":20,\"memory_type\":\"DDR4 ECC \u001b[0m\n",
       "\u001b[32mSDRAM\",\"memory_size_gb\":64,\"memory_channels\":4,\"flash_type\":\"NAND Flash\",\"flash_size_gb\":256\u001b[0m\u001b[32m}\u001b[0m\u001b[32m'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \n",
       "\u001b[33musage\u001b[0m=\u001b[1;35mRequestUsage\u001b[0m\u001b[1m(\u001b[0m\u001b[1m)\u001b[0m, \u001b[33mmodel_name\u001b[0m=\u001b[32m'lms/openai/gpt-oss-20b'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m16\u001b[0m, \n",
       "\u001b[33mtzinfo\u001b[0m=\u001b[1;35mTzInfo\u001b[0m\u001b[1m(\u001b[0mUTC\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m, \u001b[33mprovider_request_id\u001b[0m=\u001b[32m'resp-0fcca8b6-fdaa-4bea-9a78-f8a99e6acba7'\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 📍 Reasoning step <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span> -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 📍 Reasoning step \u001b[1;36m4\u001b[0m -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelRequest</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RetryPromptPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'Plain text responses are not permitted, please include your response </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">in a tool call'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'pyd_ai_666d4ee530914de883cd144c2170c728'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, \n",
       "<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">34262</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080\">datetime</span>.timezone.utc<span style=\"font-weight: bold\">))])</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelRequest\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mRetryPromptPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mcontent\u001b[0m=\u001b[32m'Plain text responses are not permitted, please include your response \u001b[0m\n",
       "\u001b[32min a tool call'\u001b[0m, \u001b[33mtool_call_id\u001b[0m=\u001b[32m'pyd_ai_666d4ee530914de883cd144c2170c728'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \n",
       "\u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m34262\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[35mdatetime\u001b[0m.timezone.utc\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelResponse</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolCallPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'final_result'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">args</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'{\"cpu_name\":\"Intel Xeon D-2800 </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">series\",\"cpu_num_cores\":20,\"memory_type\":\"DDR4 ECC </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">SDRAM\",\"memory_size_gb\":64,\"memory_channels\":4,\"flash_type\":\"NAND Flash\",\"flash_size_gb\":256}'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'464471396'</span><span style=\"font-weight: bold\">)]</span>, <span style=\"color: #808000; text-decoration-color: #808000\">usage</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">RequestUsage</span><span style=\"font-weight: bold\">()</span>, <span style=\"color: #808000; text-decoration-color: #808000\">model_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'lms/openai/gpt-oss-20b'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">TzInfo</span><span style=\"font-weight: bold\">(</span>UTC<span style=\"font-weight: bold\">))</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">provider_request_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'resp-f12a17ef-84a8-40ca-b7e5-f16e2bcfbe24'</span><span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelResponse\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolCallPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'final_result'\u001b[0m, \u001b[33margs\u001b[0m=\u001b[32m'\u001b[0m\u001b[32m{\u001b[0m\u001b[32m\"cpu_name\":\"Intel Xeon D-2800 \u001b[0m\n",
       "\u001b[32mseries\",\"cpu_num_cores\":20,\"memory_type\":\"DDR4 ECC \u001b[0m\n",
       "\u001b[32mSDRAM\",\"memory_size_gb\":64,\"memory_channels\":4,\"flash_type\":\"NAND Flash\",\"flash_size_gb\":256\u001b[0m\u001b[32m}\u001b[0m\u001b[32m'\u001b[0m, \n",
       "\u001b[33mtool_call_id\u001b[0m=\u001b[32m'464471396'\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m, \u001b[33musage\u001b[0m=\u001b[1;35mRequestUsage\u001b[0m\u001b[1m(\u001b[0m\u001b[1m)\u001b[0m, \u001b[33mmodel_name\u001b[0m=\u001b[32m'lms/openai/gpt-oss-20b'\u001b[0m, \n",
       "\u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[33mtzinfo\u001b[0m=\u001b[1;35mTzInfo\u001b[0m\u001b[1m(\u001b[0mUTC\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m, \n",
       "\u001b[33mprovider_request_id\u001b[0m=\u001b[32m'resp-f12a17ef-84a8-40ca-b7e5-f16e2bcfbe24'\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 📍 Reasoning step <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">5</span> -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 📍 Reasoning step \u001b[1;36m5\u001b[0m -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ModelRequest</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">parts</span>=<span style=\"font-weight: bold\">[</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ToolReturnPart</span><span style=\"font-weight: bold\">(</span><span style=\"color: #808000; text-decoration-color: #808000\">tool_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'final_result'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">content</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'Final result processed.'</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">tool_call_id</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'464471396'</span>, <span style=\"color: #808000; text-decoration-color: #808000\">timestamp</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">datetime</span><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">.datetime</span><span style=\"font-weight: bold\">(</span><span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">2025</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">8</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">22</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">13</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">23</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">24</span>, <span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">312937</span>, \n",
       "<span style=\"color: #808000; text-decoration-color: #808000\">tzinfo</span>=<span style=\"color: #800080; text-decoration-color: #800080\">datetime</span>.timezone.utc<span style=\"font-weight: bold\">))])</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mModelRequest\u001b[0m\u001b[1m(\u001b[0m\u001b[33mparts\u001b[0m=\u001b[1m[\u001b[0m\u001b[1;35mToolReturnPart\u001b[0m\u001b[1m(\u001b[0m\u001b[33mtool_name\u001b[0m=\u001b[32m'final_result'\u001b[0m, \u001b[33mcontent\u001b[0m=\u001b[32m'Final result processed.'\u001b[0m, \n",
       "\u001b[33mtool_call_id\u001b[0m=\u001b[32m'464471396'\u001b[0m, \u001b[33mtimestamp\u001b[0m=\u001b[1;35mdatetime\u001b[0m\u001b[1;35m.datetime\u001b[0m\u001b[1m(\u001b[0m\u001b[1;36m2025\u001b[0m, \u001b[1;36m8\u001b[0m, \u001b[1;36m22\u001b[0m, \u001b[1;36m13\u001b[0m, \u001b[1;36m23\u001b[0m, \u001b[1;36m24\u001b[0m, \u001b[1;36m312937\u001b[0m, \n",
       "\u001b[33mtzinfo\u001b[0m=\u001b[35mdatetime\u001b[0m.timezone.utc\u001b[1m)\u001b[0m\u001b[1m)\u001b[0m\u001b[1m]\u001b[0m\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">----- 🎯 Final answer -----\n",
       "</pre>\n"
      ],
      "text/plain": [
       "----- 🎯 Final answer -----\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #808000; text-decoration-color: #808000\">The agent 🤖 extracted the following content:</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[33mThe agent 🤖 extracted the following content:\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">HardwareSpecs</span><span style=\"font-weight: bold\">(</span>\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">cpu_name</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'Intel Xeon D-2800 series'</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">cpu_num_cores</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">20</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">memory_type</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'DDR4 ECC SDRAM'</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">memory_size_gb</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">64</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">memory_channels</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">4</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">flash_type</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'NAND Flash'</span>,\n",
       "<span style=\"color: #7fbf7f; text-decoration-color: #7fbf7f\">│   </span><span style=\"color: #808000; text-decoration-color: #808000\">flash_size_gb</span>=<span style=\"color: #008080; text-decoration-color: #008080; font-weight: bold\">256</span>\n",
       "<span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mHardwareSpecs\u001b[0m\u001b[1m(\u001b[0m\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mcpu_name\u001b[0m=\u001b[32m'Intel Xeon D-2800 series'\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mcpu_num_cores\u001b[0m=\u001b[1;36m20\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mmemory_type\u001b[0m=\u001b[32m'DDR4 ECC SDRAM'\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mmemory_size_gb\u001b[0m=\u001b[1;36m64\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mmemory_channels\u001b[0m=\u001b[1;36m4\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mflash_type\u001b[0m=\u001b[32m'NAND Flash'\u001b[0m,\n",
       "\u001b[2;32m│   \u001b[0m\u001b[33mflash_size_gb\u001b[0m=\u001b[1;36m256\u001b[0m\n",
       "\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from typing import Annotated\n",
    "from pydantic import BaseModel, Field\n",
    "\n",
    "from pydantic_ai import Agent\n",
    "\n",
    "# Define the agent\n",
    "agent = Agent(model=model, toolsets=[docling_mcp])\n",
    "\n",
    "\n",
    "# Define the schema\n",
    "class HardwareSpecs(BaseModel):\n",
    "    cpu_name: Annotated[str, Field(description=\"Name of the CPU\")]\n",
    "    cpu_num_cores: Annotated[int, Field(description=\"Number of CPU cores\")]\n",
    "\n",
    "    memory_type: Annotated[str, Field(description=\"The type of RAM memory\")]\n",
    "    memory_size_gb: Annotated[\n",
    "        int, Field(description=\"The size of the RAM memory in GB\")\n",
    "    ]\n",
    "    memory_channels: Annotated[int, Field(description=\"Number of RAM memory channels\")]\n",
    "\n",
    "    flash_type: Annotated[str, Field(description=\"The type of flash memory\")]\n",
    "    flash_size_gb: Annotated[\n",
    "        int, Field(description=\"The size of the flash memory in GB\")\n",
    "    ]\n",
    "\n",
    "\n",
    "# Run the agent\n",
    "prompt = (\n",
    "    \"Convert the document on https://www.xes-inc.com/assets/products/datasheets/XPedite7871-DS.pdf \"\n",
    "    \"to DoclingDocument. And use its markdown representation for extracting \"\n",
    "    \"the hardware specs of the card.\"\n",
    ")\n",
    "\n",
    "print_user(prompt)\n",
    "result = agent.run_sync(prompt, output_type=HardwareSpecs)\n",
    "print_steps(result.new_messages())\n",
    "\n",
    "# Final result\n",
    "console.print(\"----- 🎯 Final answer -----\")\n",
    "console.print(f\"[yellow]The agent 🤖 extracted the following content:[/yellow]\")\n",
    "pprint(result.output)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4198e6ac",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "pydanticai",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
